-# $Id: app.pro,v 1.14 2010/01/05 15:01:30 robertl Exp $
+# $Id: app.pro,v 1.15 2010/02/14 21:29:05 robertl Exp $
#
CONFIG += qt release
win32:TARGET=GPSBabelFE
unix:TARGET=gpsbabelfe-bin
-FORMS += mainwinui.ui
-FORMS += advui.ui
FORMS += aboutui.ui
-FORMS += trackui.ui
+FORMS += advui.ui
FORMS += filterui.ui
-FORMS += wayptsui.ui
-FORMS += rttrkui.ui
-FORMS += miscfltui.ui
FORMS += gmapui.ui
+FORMS += mainwinui.ui
+FORMS += miscfltui.ui
+FORMS += preferences.ui
+FORMS += rttrkui.ui
+FORMS += trackui.ui
FORMS += upgrade.ui
+FORMS += wayptsui.ui
+SOURCES += aboutdlg.cpp
SOURCES += advdlg.cpp
SOURCES += dpencode.cpp
-SOURCES += map.cpp
-SOURCES += latlng.cpp
-SOURCES += gpx.cpp
+SOURCES += filterdata.cpp
+SOURCES += filterdlg.cpp
+SOURCES += filterwidgets.cpp
+SOURCES += format.cpp
+SOURCES += formatload.cpp
SOURCES += gmapdlg.cpp
-SOURCES += aboutdlg.cpp
-SOURCES += main.cpp
+SOURCES += gpx.cpp
SOURCES += help.cpp
+SOURCES += latlng.cpp
+SOURCES += main.cpp
SOURCES += mainwindow.cpp
-SOURCES += format.cpp
-SOURCES += filterdata.cpp
-SOURCES += formatload.cpp
+SOURCES += map.cpp
SOURCES += optionsdlg.cpp
+SOURCES += preferences.cpp
SOURCES += processwait.cpp
-SOURCES += filterwidgets.cpp
-SOURCES += filterdlg.cpp
SOURCES += upgrade.cpp
macx:SOURCES += serial_mac.cpp
unix:SOURCES += serial_unix.cpp
windows:SOURCES += serial_win.cpp
-HEADERS += mainwindow.h
-HEADERS += map.h
-HEADERS += gmapdlg.h
-HEADERS += gpx.h
+HEADERS += aboutdlg.h
+HEADERS += advdlg.h
+HEADERS += appname.h
HEADERS += babeldata.h
+HEADERS += filterdata.h
HEADERS += filterdlg.h
-HEADERS += appname.h
-HEADERS += advdlg.h
-HEADERS += aboutdlg.h
-HEADERS += help.h
+HEADERS += filterwidgets.h
HEADERS += format.h
HEADERS += formatload.h
+HEADERS += gmapdlg.h
+HEADERS += gpx.h
+HEADERS += help.h
+HEADERS += mainwindow.h
+HEADERS += map.h
HEADERS += optionsdlg.h
+HEADERS += preferences.h
HEADERS += processwait.h
-HEADERS += filterwidgets.h
-HEADERS += filterdata.h
HEADERS += setting.h
HEADERS += upgrade.h
// -*- C++ -*-
-// $Id: mainwindow.cpp,v 1.14 2010/02/14 05:33:37 robertl Exp $
+// $Id: mainwindow.cpp,v 1.15 2010/02/14 21:29:06 robertl Exp $
//------------------------------------------------------------------------
//
// Copyright (C) 2009 S. Khai Mong <khai@mangrai.com>.
#include <QTemporaryFile>
#include "mainwindow.h"
-#include "babeldata.h"
-#include "appname.h"
-#include "help.h"
-#include "advdlg.h"
#include "aboutdlg.h"
-#include "optionsdlg.h"
+#include "advdlg.h"
+#include "appname.h"
+#include "babeldata.h"
#include "filterdlg.h"
-#include "processwait.h"
#include "formatload.h"
#include "gmapdlg.h"
+#include "help.h"
+#include "optionsdlg.h"
+#include "preferences.h"
+#include "processwait.h"
#include "upgrade.h"
#include "../gbversion.h"
connect(ui.actionQuit, SIGNAL(triggered()), this, SLOT(closeActionX()));
connect(ui.actionHelp, SIGNAL(triggered()), this, SLOT(helpActionX()));
connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(aboutActionX()));
+ connect(ui.actionPreferences, SIGNAL(triggered()), this, SLOT(preferencesActionX()));
connect(ui.inputFormatCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(inputFormatChanged(int)));
aboutDlg.exec();
}
+//------------------------------------------------------------------------
+void MainWindow::preferencesActionX()
+{
+ Preferences preferences(0, formatList);
+ preferences.exec();
+}
+
+
//------------------------------------------------------------------------
void MainWindow::helpActionX()
{
// -*- C++ -*-
-// $Id: mainwindow.h,v 1.7 2009/09/15 18:04:03 robertl Exp $
+// $Id: mainwindow.h,v 1.8 2010/02/14 21:29:06 robertl Exp $
//------------------------------------------------------------------------
//
// Copyright (C) 2009 S. Khai Mong <khai@mangrai.com>.
void closeEvent(QCloseEvent*);
private slots:
- void inputFileOptBtnClicked();
- void inputDeviceOptBtnClicked();
- void inputOptionButtonClicked();
- void inputFormatChanged(int);
+ void aboutActionX();
+ void applyActionX();
void browseInputFile();
- void outputFileOptBtnClicked();
- void outputDeviceOptBtnClicked();
- void outputOptionButtonClicked();
- void outputFormatChanged(int);
void browseOutputFile();
- void moreOptionButtonClicked();
- void applyActionX();
- void aboutActionX();
- void helpActionX();
void closeActionX();
void filtersClicked();
+ void helpActionX();
+ void inputDeviceOptBtnClicked();
+ void inputFileOptBtnClicked();
+ void inputFormatChanged(int);
+ void inputOptionButtonClicked();
+ void moreOptionButtonClicked();
+ void outputDeviceOptBtnClicked();
+ void outputFileOptBtnClicked();
+ void outputFormatChanged(int);
+ void outputOptionButtonClicked();
+ void preferencesActionX();
void resetFormatDefaults();
};
<property name="title">
<string>File</string>
</property>
+ <addaction name="actionPreferences"/>
<addaction name="actionQuit"/>
</widget>
<widget class="QMenu" name="menuHelp">
<string>Quit</string>
</property>
</action>
+ <action name="actionPreferences">
+ <property name="text">
+ <string>Preferences...</string>
+ </property>
+ </action>
</widget>
<resources>
<include location="app.qrc"/>
--- /dev/null
+//
+// Copyright (C) 2010 Robert Lipe <robertlipe@gpsbabel.org>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111
+// USA
+
+
+#include <QSettings>
+#include "preferences.h"
+
+class FormatListEntry : public QListWidgetItem {
+ public:
+ FormatListEntry(Format& fmt) : fmt_(fmt) {
+ setText(fmt.getDescription());
+ bool enabled = !fmt.isHidden();
+ setCheckState(enabled ? Qt::Checked : Qt::Unchecked);
+ }
+
+ private:
+ Format& fmt_;
+};
+
+Preferences::Preferences(QWidget* parent, QList<Format>& formatList) :
+ formatList_(formatList)
+{
+ ui_.setupUi(this);
+
+ // TODO: read from prefs.
+ // ui_.startupCheck->setChecked(true);
+ connect (ui_.buttonBox, SIGNAL(accepted()), this, SLOT(acceptClicked()));
+ connect (ui_.buttonBox, SIGNAL(rejected()), this, SLOT(rejectClicked()));
+
+ connect (ui_.enableAllButton, SIGNAL(clicked()), this, SLOT(enableAllClicked()));
+ connect (ui_.disableAllButton, SIGNAL(clicked()), this, SLOT(disableAllClicked()));
+
+ for (int i = 0; i < formatList_.size(); i++) {
+ FormatListEntry *item = new FormatListEntry(formatList[i]);
+
+ ui_.enabledFormatsList->insertItem(0, item);
+ }
+}
+
+void Preferences::enableAllClicked()
+{
+ for (int i = 0; i < ui_.enabledFormatsList->count(); i++) {
+ QListWidgetItem* item = ui_.enabledFormatsList->item(i);
+ item->setCheckState(Qt::Checked);
+ }
+}
+
+void Preferences::disableAllClicked()
+{
+ for (int i = 0; i < ui_.enabledFormatsList->count(); i++) {
+ QListWidgetItem* item = ui_.enabledFormatsList->item(i);
+ item->setCheckState(Qt::Unchecked);
+ }
+}
+
+void Preferences::acceptClicked()
+{
+ accept();
+}
+
+void Preferences::rejectClicked()
+{
+ reject();
+}
--- /dev/null
+#ifndef PREFERENCES_H_
+#define PREFERENCES_H_
+
+//
+// Copyright (C) 2010 Robert Lipe <robertlipe@gpsbabel.org>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111
+// USA
+
+#include "ui_preferences.h"
+#include "format.h"
+
+class Preferences : public QDialog {
+ Q_OBJECT
+
+ public:
+ Preferences(QWidget* parent, QList<Format>& formatList);
+
+ private:
+ QList<Format>& formatList_;
+ Ui_Preferences ui_;
+
+ private slots:
+ void enableAllClicked();
+ void disableAllClicked();
+ void acceptClicked();
+ void rejectClicked();
+};
+
+#endif // PREFERENCES_H_
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Preferences</class>
+ <widget class="QDialog" name="Preferences">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>777</width>
+ <height>351</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>GPSBabel Preferences</string>
+ </property>
+ <layout class="QFormLayout" name="formLayout">
+ <item row="0" column="0">
+ <widget class="QTabWidget" name="tabWidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="currentIndex">
+ <number>1</number>
+ </property>
+ <widget class="QWidget" name="general_tab">
+ <attribute name="title">
+ <string>General</string>
+ </attribute>
+ <widget class="QWidget" name="layoutWidget">
+ <property name="geometry">
+ <rect>
+ <x>23</x>
+ <y>18</y>
+ <width>234</width>
+ <height>43</height>
+ </rect>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout_4">
+ <item>
+ <widget class="QCheckBox" name="startupCheck">
+ <property name="text">
+ <string>Check for newer version on start.</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="checkBox">
+ <property name="text">
+ <string>Anonymously report usage data.</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ <widget class="QWidget" name="format_tab">
+ <attribute name="title">
+ <string>Formats</string>
+ </attribute>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Enabled Formats</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QListWidget" name="enabledFormatsList">
+ <property name="sortingEnabled">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QPushButton" name="enableAllButton">
+ <property name="text">
+ <string>Enable All</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="disableAllButton">
+ <property name="text">
+ <string>Disable All</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
// -*- C++ -*-
-// $Id: upgrade.cpp,v 1.20 2010/02/14 05:33:37 robertl Exp $
+// $Id: upgrade.cpp,v 1.21 2010/02/14 21:29:06 robertl Exp $
/*
Copyright (C) 2009, 2010 Robert Lipe, robertlipe@gpsbabel.org
currentVersion = currentVersionIn;
currentVersion.remove("GPSBabel Version ");
upgradeCheckMethod = checkMethod;
-// formatList_ = &formatList;
QDateTime soonestCheckTime = lastCheckTime.addDays(1);
if (!testing && QDateTime::currentDateTime() < soonestCheckTime) {